<html>
  <head>
    <script src="../../resources/js-test.js"></script>
    <style>
      #target {
        display: flex;
        display: -webkit-flex;
      }
    </style>
    <script>
      var targetDiv;

      function test()
      {
        targetDiv = document.getElementById('target');
        targetDiv.focus();

        if (window.testRunner) {
          // Move cursor to the end of line.
          eventSender.keyDown("End", []);

          eventSender.keyDown('E');
          eventSender.keyDown('S');
          eventSender.keyDown('T');
          shouldBeEqualToString("targetDiv.innerText", "TEST");

          eventSender.keyDown("Backspace", []);
          eventSender.keyDown("Backspace", []);
          eventSender.keyDown("Backspace", []);
          eventSender.keyDown("Backspace", []);
          shouldBeEmptyString("targetDiv.innerText");

          eventSender.keyDown('T');
          eventSender.keyDown('E');
          eventSender.keyDown('S');
          eventSender.keyDown('T');
          shouldBeEqualToString("targetDiv.innerText", "TEST");
        }
      }
    </script>
  </head>

  <body onload="test()">
    <div id="target" contentEditable>T</div>
  </body>
</html>
